package jp.tkym.labs.store.ormap;

import java.util.ArrayList;
import java.util.List;

public class OrMapObject {
	
	private String objectName;
	private List<OrMapElement> elements = new ArrayList<OrMapElement>();
	private List<OrMapElement> keyList = new ArrayList<OrMapElement>();
	
	public void setObjectName(String objectName) {
		this.objectName = objectName;
	}
	public String getObjectName() {
		return objectName;
	}
	
	public void addElement(OrMapElement element){
		elements.add(element);
	}
	
	public void removeElement(OrMapElement column){
		elements.remove(column);
	}
	
	public List<OrMapElement> elements(){
		return elements;
	}
	
	public void addId(OrMapElement element){
		keyList.add(element);
	}
	public void removeId(OrMapElement element){
		keyList.remove(element);
	}
	
	public List<OrMapElement> ids(){
		return keyList;
	}
	
	public String[] keyProperties(){
		List<String> keyProperties = new ArrayList<String>();
		for(OrMapElement element : ids()) keyProperties.add(element.getPropertyName());
		String[] arrays = new String[keyProperties.size()];
		keyProperties.toArray(arrays);
		return arrays;
	}
}
